% Function to show the histogram
function F_Histogram(max)                                % using max to represent the length of the sequence
r=rand(max,1);                                           % using the vector r to store the sequence of random numbers
figure;
[N,X]=hist(r,10);                                        % making a histogram for the values with ten equal bins of length 0.1.
                                                         % N represents the frequency and X is the bin 
var=std(N)/mean(N);                                      % using standard error to calculate the variation
hist(r,10);hold on;
plot(X,N,'-r');
title('histogram');xlabel('range');ylabel('number');
disp('Measured as standard error, the variation is  ');
disp(var);                                               % showing the variation
end

